package dongshi.daddy.huohuo;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;

public class A {
    public void sayHi(String message) {
        System.out.println("sayhi::" + message);
    }

    public static void main(String[] args) throws Exception {
        /*System.out.println(1 + 5 / 2 + 2);
        System.out.println(2 > 5);
        System.out.println(2 + 5 / 2 + 2 > 5);
        Long a=1L;
        String b=null;
        System.out.println(a.toString());
        b=a+"";
        System.out.println(b);*/
        List<Map<String, String>> list = new ArrayList<Map<String, String>>();
        Map<String, String> m1 = new HashMap<String, String>();
        m1.put("name", "张三");
        m1.put("age", "66");
        list.add(m1);
        Map<String, String> m2 = new HashMap<String, String>();
        m2.put("name", "李四");
        m2.put("age", "55");
        list.add(m2);
        Map<String, String> m3 = new HashMap<String, String>();
        m3.put("name", "李四");
        m3.put("age", "99");
        list.add(m3);
/*
        Map<String, List<Map<String, String>>> name = list.stream().collect(Collectors.groupingBy(v -> v.get("name")));
        System.out.println(name);*/

        Map<String, String> collect = list.stream().collect(Collectors.toMap(t -> t.get("age"), t -> t.get("name")));
        System.out.println(collect);
        while (true) {
            TimeUnit.SECONDS.sleep(10);
            System.out.println("collect: " + collect);
        }
    }
}
